package com.dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import org.springframework.stereotype.Repository;

import com.db.DBManager;
import com.domain.User;

@Repository("loginDao")
public class LoginDaoImpl extends BaseDaoImpl {

	// 查询数据
	public Object queData(String url) {

		ResultSet result = null;
		User user = new User();
		try {
			Connection conn = DBManager.getConn();
			PreparedStatement ps = conn.prepareStatement(url);
			result = ps.executeQuery();
			if (result != null && result.next()) {
				user = new User(result.getString("userId"), null,
						result.getString("name"), result.getString("role"));
			}
			DBManager.close(result, ps, conn);
		} catch (Exception e) {
			e.printStackTrace();
		}

		return user;
	}
}
